<?php defined('SYSPATH') OR die('No direct access allowed.');

class javascript
{
    static protected $scripts = array();
    static protected $will_already_be_auto_rendered = false;

    static public function add($file)
    {
    if (is_array($file)) {
        self::$scripts = arr::merge(self::$scripts, $file);
    } else
        if (!in_array($file, self::$scripts))
            self::$scripts[] = $file;
    }

    static public function render($print = FALSE)
    {
            $output = '';
            foreach (self::$scripts as $script)
                    $output .= html::script($script);

            if ($print)
                    echo $output;

            return $output;
    }

} // End javascript_Core